//
//  ViewController.swift
//  day05
//
//  Created by 杨绍鑫 on 2018/9/9.
//  Copyright © 2018年 crcnet. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var colltionView: UICollectionView!
    let data = Interest.ceatInterests()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        colltionView.dataSource = self
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    override var preferredStatusBarStyle: UIStatusBarStyle{
        return UIStatusBarStyle.lightContent
    }
    
    fileprivate struct Storyb{
        static let cell = "InterestCell"
    }
}

extension ViewController:UICollectionViewDataSource{
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return data.count
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = colltionView.dequeueReusableCell(withReuseIdentifier: Storyb.cell, for: indexPath) as! InterestCell
        cell.interest = self.data[indexPath.row]
        return cell
        
    }
}
